#include "dwgpolyline.h"

DwgPolyLine::DwgPolyLine()
{
    mType = DPLine;
}

void DwgPolyLine::addPoint(const QPoint& point){
    m_points.append(point);
}

void DwgPolyLine::Draw(QPainter* painter){
    if (m_points.size() < 2){
        return;     //至少两个点才绘制，否则不响应
    }

    //设置画笔属性：线宽、颜色等
    QPen pen(Qt::black);
    pen.setWidth(2);
    painter->setPen(pen);

    //开始绘制折线
    painter->drawPolyline(m_points.data(), m_points.size());
}
